<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>手机商城</title>
<!-- CSS -->
<!--<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">-->
<link rel="stylesheet" href="{url:#css/materialize.min.css}" />
<link rel="stylesheet" href="{url:#css/me.css}" />
<link rel="stylesheet" href="{url:#css/iconfont.css}" />
<!-- JS -->
<script src="{url:#js/jquery-1.11.3.min.js}"></script>
<script src="{url:#js/materialize.min.js}"></script>
<script src="{url:#js/home/classify_products.js}"></script>
<script src="{url:#js/yang_check.js}"></script>

</head>
<body>
<!-- TitleBar 开始 -->
<div class="navbar-fixed custom-navbar">
  <nav>
    <div class="nav-wrapper red accent-4 valign-wrapper custom-navbar">
      <ul class="left" id="nav-btn-left" onclick="document.location.href='{url:/mobile/user_center}'">
        <li><a ><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
      <span class="title-bar-size center_align">订单列表</span>
      <ul class="right">
        <li><a class="disabled" style="visibility:hidden"><i class="iconfont">&#xe63c;</i></a></li>
      </ul>
    </div>
  </nav>
</div>
<!-- TitleBar 结束 -->


<!-- 商品列表 -->
<div class="order_list">
	<ul class="mgr-0 padd-0">
	{list:items=$order_list}
		<li>
		<a href="{url:/mobile/order_detail/id/$item[id]}">
			<div class="left">
				订单号: {$item['order_no']}
			</div>
			<div class="right red-text">
				
				{if:$item['order_status']==0}
					已关闭
				{elseif:$item['order_status']==1}
					待付款
				{elseif:$item['order_status']==2}
					待发货
				{elseif:$item['order_status']==3}
					待收货
				{elseif:$item['order_status']==4}
					
				{elseif:$item['order_status']==5 || $item['order_status']==6}
					退款中
				{/if}
				{if:$item['order_status']==4}
				{set:$is_comm=Common::check_order_is_comment($item['order_no'])}
				{if:$is_comm}
					已评价
				{else:}
					待评价
				{/if}
				{/if}
				
			</div>
			<div class="clearfix"></div>
			<div style="margin-top:10px;">
				<img width="60" height="60" src="{$item['img']}"/>
				<p class="description">{$item['goods_name_str']}</p>
				<p class="description" style="margin-top:-15px;">下单时间: {$item['create_time']}</p>
				<p class="description" style="margin-top:-15px;">订单金额: <span style="color:red;">{$item['order_amount']}</span></p>
			</div>
			<div class="clearfix"></div>
			<div class="deshed-divider"></div>
			<!-- 操作按钮 -->
			<div class="order-action">
				<!-- 
				<a class="waves-effect waves-light act_btn" onclick="order_del({$item['id']})">取消订单</a>
				-->
				<a class="waves-effect waves-light act_btn" style="font-size:12px;" href="{url:/mobile/order_detail/id/$item[id]}">订单详情</a>
				{if:$item['order_status']==1}
					<a class="waves-effect waves-light act_btn" style="font-size:12px;" href="{url:/mobile/pay_order}&order_id={$item['id']}">立即支付</a>
					<!-- 
					<a class="waves-effect waves-light act_btn" onclick="return confirm('确定要执行此操作吗？')" style="font-size:12px;" href="{url:/mobile/del_order}&order_id={$item['id']}">删除订单</a>
					-->
					<a class="waves-effect waves-light act_btn" onclick="del_order({$item['id']})" style="font-size:12px;">取消订单</a>
				{elseif:$item['order_status']==2}
					<a class="waves-effect waves-light act_btn" style="font-size:12px;" href="{url:/mobile/refund/id/$item[id]}">申请退款</a>
				{elseif:$item['order_status']==3}
					<!-- 
					<a class="waves-effect waves-light act_btn" href="{url:/mobile/sign_order}&id={$item['id']}">订单签收</a>
					-->
					<a class="waves-effect waves-light act_btn" style="font-size:12px;" onclick="sign_order(this,{$item[id]})">签收订单</a>
				{elseif:$item['order_status']==4 && $is_comm==false}
					<a class="waves-effect waves-light act_btn" style="font-size:12px;" href="{url:/mobile/comment_order/id/$item[id]}">评价订单</a>
				{/if}
			</div>
			<div class="clearfix"></div>
		</a>
		</li>
		<li class="dividerli">
			<div class="divider"></div>
		</li>
	{/list}	
		
	</ul>
</div>
<!-- 列表结束 -->
<script type="text/javascript">
function sign_order(obj,id)
{
	if( confirm('确定要执行此操作吗？') )
	{
		$(obj).removeAttr('onclick');
		$.post("{url:/mobile/sign_order}",{id:id},function(data){
			if(data['status']=='success')
		    {
			    //alert('操作成功');
			    window.location.replace("{url:/mobile/user_center}");
			    //个人中心页面
	            document.location.href="{url:/mobile/order_list/type/4}";
	        }
	        else
		    {
	            yang_alert(data['msg']);
	            window.location.replace("{url:/mobile/user_center}");
	            document.location.href=document.location.href;
	        }
	    },'json');
	}
}




function del_order(id)
{
	if( confirm('确定要执行此操作吗？') )
	{
		$.post("{url:/mobile/del_order}",{order_id:id},function(data){
			if(data['status']=='success')
		    {
			    alert(data['msg']);
			    //个人中心页面
	            document.location.href=document.location.href;
	        }
	        else
		    {
	            alert(data['msg']);
	            document.location.href=document.location.href;
	        }
	    },'json');
	}
}

</script>
</body>
</html>
